<template>
  <div>
    <div class="header">
      <div class="wrap">
        <div
          class="logo"
          @click="showClick">
        <h1>Vite3 + Vue3 + Ts</h1>
        </div>
        <div class="nav">
          <dl class="list">
            <dd
              v-for="item in nav"
              :key="item.path"
              class="item">
              <router-link :to="item.path">
                <span>{{ item.title }}</span>
              </router-link>
            </dd>
          </dl>
        </div>
      </div>
    </div>
    <div class="home-banner">
      
    </div>
  </div>
</template>

<script setup lang="ts">
  // 定义变量
  const nav = [
    { title: '单页面', path: '/' },
    { title: '列表页面', path: '/about' },
    { title: '表单页面', path: '/news' },
    { title: '图标页面', path: '/case' },
    { title: '专题页面', path: '/contact' },
    { title: '不存页面', path: '/activity' }
  ]
  
  // 触发函数
  function showClick () {
    console.log('logo被点击')
  }
</script>

<style lang="less" scoped>
  .header {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10;
    padding: 20px 0;
    .wrap {
      display: flex;
    }
    .logo {
      h1 {
        line-height: 30px;
        font-size: 24px;
        font-weight: normal;
        color: #ffffff;
      }
    }
    .nav {
      flex: 1;
      text-align: right;
      .list {
        display: block;
      }
      .item {
        display: inline-flex;
        a {
          display: block;
          height: 30px;
          line-height: 30px;
          color: #ffffff;
          font-size: 18px;
          padding: 0 20px;
        }
      }
    }
  }

  .home-banner {
    height: 100px;
    background: #883333;
  }
</style>